package cn.edu.xmu.oomall.aftersales.microservice;

import cn.edu.xmu.oomall.aftersales.microservice.vo.PaymentVo;
import cn.edu.xmu.oomall.aftersales.microservice.vo.SimplePaymentRetVo;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


/**
 * @author Jiawei Zheng
 * @date 2021-12-11
 */
@FeignClient(name="payment-service")
public interface PaymentService {

    /**
     * 用户调用，根据单据Id查询支付信息
     * @param documentId
     * @return
     */
    @GetMapping("internal/document/{documentId}/payment")
    InternalReturnObject<SimplePaymentRetVo> getPaymentByDocumentId(@PathVariable("documentId")String documentId);

    @PostMapping("/internal/payments")
    InternalReturnObject pay(@RequestBody PaymentVo paymentVo);

    @PostMapping("internal/document/{documentId}/refund")
    InternalReturnObject refund(@PathVariable String documentId, @RequestParam Long amount, @RequestParam Byte documentType, @RequestParam String descr);

    @PostMapping("internal/document/{documentId}/refund/all")
    InternalReturnObject refundAll(@PathVariable String documentId,@RequestParam Byte documentType,@RequestParam String descr);
}
